package com.jadeen.controller.serverController;


import com.jadeen.common.controller.BaseController;
import com.jadeen.common.domain.AjaxResult;
import com.jadeen.common.page.TableDataInfo;
import com.jadeen.entity.domain.ResourceTag;
import com.jadeen.service.IResourceTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 资源标签关联Controller
 * 
 * @author jadeen
 * @date 2025-08-08
 */
@RestController
@RequestMapping("/resourceShare/tag")
public class ResourceTagController extends BaseController
{
    @Autowired
    private IResourceTagService resourceTagService;

    /**
     * 查询资源标签关联列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ResourceTag resourceTag)
    {
        startPage();
        List<ResourceTag> list = resourceTagService.selectResourceTagList(resourceTag);
        return getDataTable(list);
    }


    /**
     * 获取资源标签关联详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(resourceTagService.selectResourceTagById(id));
    }

    /**
     * 新增资源标签关联
     */
    @PostMapping
    public AjaxResult add(@RequestBody ResourceTag resourceTag)
    {
        return toAjax(resourceTagService.insertResourceTag(resourceTag));
    }

    /**
     * 修改资源标签关联
     */
    @PutMapping
    public AjaxResult edit(@RequestBody ResourceTag resourceTag)
    {
        return toAjax(resourceTagService.updateResourceTag(resourceTag));
    }

    /**
     * 删除资源标签关联
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(resourceTagService.deleteResourceTagByIds(ids));
    }
}
